package net.trade.trade.action;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import net.core.base.struts.BaseAction;
import net.trade.trade.service.ITradeReportService;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.InterceptorRef;
import org.apache.struts2.convention.annotation.InterceptorRefs;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;

@Scope("request")
@Namespace("/trade/report")
@InterceptorRefs(@InterceptorRef("basicStack"))
@ParentPackage("struts-default")
@Results({ @Result(name = "error", location = "/login.jsp") })
public class TradeReportAction extends BaseAction {
	private static final long serialVersionUID = 1L;
	@Autowired
	ITradeReportService service;

	private String recId;
	
	private List list;
	
	private Map returnMap;
	
	private String html;

	public String getRecId() {
		return recId;
	}

	public void setRecId(String recId) {
		this.recId = recId;
	}

	public Map getReturnMap() {
		return returnMap;
	}

	public void setReturnMap(Map returnMap) {
		this.returnMap = returnMap;
	}
	
	public List getList() {
		return list;
	}

	public void setList(List list) {
		this.list = list;
	}

	public String getHtml() {
		return html;
	}

	public void setHtml(String html) {
		this.html = html;
	}

	@Action(value = "daystatic", results = { @Result(name = "success", location = "/WEB-INF/pages/trade/DayStatic.jsp") })
	public String daystatic() {
		// 每日统计
		html = service.getDayStatic();
		return SUCCESS;
	}

	@Action(value = "profitrank", results = { @Result(name = "success", location = "/WEB-INF/pages/trade/ProfitRank.jsp") })
	public String profitrank() {
		// 盈利排行
		list = service.getDayProfitRank();
		return SUCCESS;
	}
}
